<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.staticfile.net/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
    JavaScript实际上是一种脚本语言，与java并没有关系
    <div id="content">这是一个文本</div>
    <input type="text" name="文本框1" id="txt"><br>
    <input type="text" name="文本框2" id="txt2"><br>
    <button id="btn">点我看一看</button><br>
    <a href="https://www.baidu.com" id="baidu">百度</a>
    <ol>
        <li>aaa</li>
        <li>bbb</li>
        <li>ccc</li>
    </ol>

    <script>
        $(document).ready(function(){
            $("#btn").click(function(){
                alert("你好 世界");
            });
            $("#content").text("这是修改之后的文本");


            //alert("Hello World");
            let name="张三";
            console.log(name);
            console.log(typeof name);
            let num=18;
            console.log(num);
            console.log(typeof num);
            let aa=true;
            console.log(aa);
            console.log(typeof aa);
            let bb;
            //表示变量未初始化，undefind
            console.log(bb);
            console.log(typeof bb);
            
            //运算符
            let age = 20;
            let age2 = "20";
            //==会进行隐式转换
            console.log("age == age2: " + (age == age2));
            console.log("age === age2: "+ (age === age2));
            
            //数组
            let arr=new Array();
            let arr2=[];
            let arr3=["hello",2,true];
            console.log(arr3[2]);
            arr[0]=2;
            console.log(arr[0]);
            console.log(arr3);
            //删除元素
            arr3.splice(1,1);
            console.log(arr3);

            //函数
            function add(x,y){
                return x+y;
            }
            console.log(add(12,12));
            
            //对象
            let student={
                "name":"赵三",
                "age":18,
                "say":function(){
                    console.log("大家好");
                }
            }
            student.say();
            console.log(student.name);
            //赋值
            console.log(student);
            student.gender="男";
            student.age=30;
            console.log(student);

            //attr()获取到属性
            let bd=$("#baidu").attr("href");
            console.log(bd);

            $("ol").append("这是表的结尾");
            $("ol").prepend("这是表的开头");
            //$("ol").empty();
            
            
            
            
        });
       
    </script>
</body>
</html>